package com.example.springbootdemo.Controller.demo;

import com.alibaba.fastjson.JSON;
import com.example.springbootdemo.Mapper.demo.demoMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class demoController {
    @Autowired
    private demoMapper maper;
    @GetMapping("/method")
    @ResponseBody
    public String Method()
    {
        return "this is a method";
    }
    @GetMapping("/dept")
    @ResponseBody
    public String getDept()
    {

        return JSON.toJSONString(maper.selectAllDept());
    }
}
